// 绑定事件函数
function addEvent(elem, type, fn) {
    if (elem.addEventListener) {
        elem.addEventListener(type, fn, false);
    } else if (elem.attachEvent) {
        elem.attachEvent('on' + type, function () {
            fn.call(elem);
        })
    } else {
        el['on' + type] = fn;
    }
}